﻿using System;

namespace Program14
{
    class Program
    {
        static void Main(string[] args)
        {
            // 鼓组联系 1：从一个整数数组种取出最大的整数，最小数组，总会，平均值

            int[] numbers = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
            int max;
            int min;
            int sum;
            max =min =numbers[0];
            sum = 0;
            for (var i = 0; i < numbers.Length; i++)
            {
                if (numbers[i] > max)
                {
                    max = numbers[i];
                }
                if (numbers[i] < min)
                    min = numbers[i];


                sum += numbers[i];
            }
            Console.WriteLine("这个数组最大值是{0},最小值是{1},和是{2},平均值是{3}", max, min, sum, sum / numbers.Length);
        }
    }
}
